<?php
namespace app\company\controller;

use app\company\validate\ConfigMiniValidate;
use app\service\traits\Crud;
use app\company\model\ConfigMini as ConfigMiniModel;
use think\Response;

class ConfigMini extends Base
{
    private ConfigMiniModel $model;

    use Crud;

    public function initialize()
    {
        parent::initialize();
        $this->model         = new ConfigMiniModel();
        $this->validateClass = ConfigMiniValidate::class;
    }

    public function detail(): Response
    {
        if(!$config = $this->model->where('company_id',$this->company_id)->find()){
            $config = ConfigMiniModel::create(['company_id' => $this->company_id]);
        }
        return $this->success('请求成功',compact('config'));
    }
}